package com.surprise.cweb.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.surprise.cweb.manager.SurpriseShopManager;
import com.surprise.cweb.utils.CommonUtil;
import com.surprise.db.entity.SurpriseShop;

/**
 * SurpriseShopController.java
 * @author xuling
 * @since 2018年9月9日
**/
@Controller
@RequestMapping(value = "/api", produces = { "application/json" })
public class SurpriseShopController {

	@Autowired
	private SurpriseShopManager surpriseShopManager;

	@RequestMapping("/getSurpriseShopList")
	@ResponseBody
	public String getSurpriseShopList() {
		List<SurpriseShop> list = surpriseShopManager.findAll();
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("data", list);
		return CommonUtil.JsonChangeObject(map);
	}
	
	@RequestMapping("/selectSurpriseShopList")
	@ResponseBody
	public String selectSurpriseShopList(@RequestParam("shopType") String shopType) {
		List<SurpriseShop> list = surpriseShopManager.findAll();
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("data", list);
		return CommonUtil.JsonChangeObject(map);
	}
	
	@RequestMapping("/applySurpriseShop")
	@ResponseBody
	public String applySurpriseShop(@RequestParam("phone") String phone,
			@RequestParam("name") String name,
			@RequestParam("shopName") String shopName,
			@RequestParam("order") String order) {
		//List<SurpriseShop> list = surpriseShopManager.findAll();
		//Map<String,Object> map = new HashMap<String,Object>();
		//map.put("data", list);
		return null;
	}
}
